package org.arch_learn.dubbo_demo.service_provider.service;

import org.apache.dubbo.config.annotation.Service;
import org.arch_learn.dubbo_demo.api.HelloService;
import org.springframework.beans.factory.annotation.Value;

//生产者消费者都配置负载均衡策略时，以消费者的为最高优先级
@Service(loadbalance = "roundrobin")
public class HelloServiceImpl implements HelloService {
    @Value("${dubbo.application.name}")
    private String appName;

    public String sayHello(String name) {
//        try {
//            Thread.sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return appName + ":" + name;
    }
}
